package com.tanjie.blackbean.core.util;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.text.AntPathMatcher;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * @author: tanjie
 * @date: 2022-04-27
 **/
@Slf4j
public abstract class UrlPathUtil {

    private UrlPathUtil() {
    }

    private static final AntPathMatcher antPathMatcher = new AntPathMatcher();

    public static boolean skip(String uri, List<String> patterns) {
        if (CollectionUtil.isEmpty(patterns)) {
            return true;
        }
        for (String skipPattern : patterns) {
            if (antPathMatcher.match(skipPattern, uri)) {
                return true;
            }
        }
        return false;
    }


}
